<%@page import="org.yate.oa.model.LoginEntity"%>
<%@page import="java.text.SimpleDateFormat, java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set value="${pageContext.request.contextPath}" var="ctx" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<link href="${ctx}/css/skin.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/css/page.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/css/jquery-ui.css" rel="stylesheet" type="text/css"/>
<style type="text/css">
 table{
 	table-layout: fixed;
 }
 #staffs td{
 	overflow: hidden;
 	text-overflow: ellipsis;
 	white-space: nowrap;
 }
</style>
<script type="text/javascript" src="${ctx}/js/jquery.js"></script>
<script type="text/javascript" src="${ctx}/js/backOffice.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery.myPagination.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery-ui.min.js"></script>
<script type="text/javascript">
	var obj = {on:true,type:'getCancels',userName:''};
	$(document).ready(function() {
		page(1);
	});
	function page(pageIndex) {
		$("#demo1").myPagination({
			currPage : pageIndex,
			ajax : {
				on : true,
				dataType : 'json',
				url : '${ctx}/leave/post',
				callback : 'showData',
				param : obj
			}
		});
	}

	function showData(data) {
		var rows = data.data.rows;
		var str = '';
		for ( var i = 0; i < rows.length; i++) {
			str += '<tr>';
			str += '<td height="30" class="left_txt2" align="middle">'
				+ ((currPage - 1) * 10 + (i + 1)) + '</td>';
			str += '<td height="30" class="left_txt2" align="middle">'
				+ (rows[i].taskType=="leave"?"请假": rows[i].taskType=="paidleave"?"调休":"加班") + '</td>';
			str += '<td height="30" class="left_txt2" align="middle">'
				+ rows[i].proposer.trueName + '</td>';
			str += '<td height="30" class="left_txt2" align="middle">'
				+ new Date(rows[i].beginDate).toLocaleString() + '</td>';	
			str += '<td height="30" class="left_txt2" align="middle">'
				+ rows[i].days + '</td>';	
			str += '</tr>';
		}
		$('#staffs').html('').html(str);
	}
	
	function search(){
		var userName = $.trim($("#userName").val());
		obj.userName = userName;
		page(1);
	}
</script>
</head>
<body style="font-size: 62.5%;">
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td width="17" height="29" valign="top"
				background="${ctx}/images/mail_leftbg.gif"><img
				src="${ctx}/images/left-top-right.gif" width="17" height="29" /></td>
			<td width="" height="29" valign="top"
				background="${ctx}/images/content-bg.gif"><table width="100%"
					height="31" border="0" cellpadding="0" cellspacing="0"
					class="left_topbg" id="table2">
					<tr>
						<td height="31"><div class="titlebt">销假管理</div></td>
					</tr>
				</table></td>
			<td width="16" valign="top"
				background="${ctx}/images/mail_rightbg.gif"><img
				src="${ctx}/images/nav-right-bg.gif" width="16" height="29" /></td>
		</tr>
		<tr>
			<td height="71" valign="middle"
				background="${ctx}/images/mail_leftbg.gif">&nbsp;</td>
			<td valign="top" bgcolor="#F7F8F9"><table width="100%"
					height="138" border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td height="13" valign="top">&nbsp;</td>
					</tr>
					<tr>
						<td valign="top"><table width="98%" border="0" align="center"
								cellpadding="0" cellspacing="0">
								<tr>
									<td class="left_txt">当前位置：销假列表</td>
								</tr>
								<tr>
									<td height="20"><table width="100%" height="1" border="0"
											cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
											<tr>
												<td></td>
											</tr>
										</table></td>
								</tr>
								<tr>
									<td><table width="100%" height="31" border="0"
											cellpadding="0" cellspacing="0" class="nowtable">
											<tr>
												<td class="left_bt2">&nbsp;&nbsp;&nbsp;&nbsp;<a href="cancelLeave.jsp">销假</a></td>
												<td width="5%" align="right"><img onclick="if($('#queryDiv').is(':visible')){$('#queryDiv').hide()}else{$('#queryDiv').show()}" src="${ctx }/images/query.png" style="cursor: pointer;"></img>&nbsp;</td>
											</tr>
										</table></td>
								</tr>
								<tr>
									<td><table width="100%" height="31" border="0"
											cellpadding="0" cellspacing="0" class="nowtable">
											<tr>
												<td class="left_bt2">&nbsp;&nbsp;&nbsp;&nbsp;销假列表</td>
											</tr>
										</table></td>
								</tr>
								<tr>
									<td width="100%" valign="top"
										style="min-height: 350px; height: 350px;">
										<table class="tblExcel" cellpadding="0" cellspacing="0">
											<thead>
												<tr>
												<td height="30" width="10%" class="left_txt2" align="center">序号</td>
												<td height="30" width="20%" class="left_txt2" align="center">类型</td>
												<td height="30" width="20%" class="left_txt2" align="center">申请人</td>
												<td height="30" width="30%" class="left_txt2" align="center">销假开始时间</td>
												<td height="30" width="20%" class="left_txt2" align="center">销假天数</td>
												</tr>
											</thead>
											<tbody id="staffs"></tbody>
										</table>
										<div id="demo1"></div>
									</td>
								</tr>
							</table></td>
					</tr>
				</table></td>
			<td background="${ctx}/images/mail_rightbg.gif">&nbsp;</td>
		</tr>
		<tr>
			<td valign="middle" background="${ctx}/images/mail_leftbg.gif"><img
				src="${ctx}/images/buttom_left2.gif" width="17" height="17" /></td>
			<td height="17" valign="top"
				background="${ctx}/images/buttom_bgs.gif"><img
				src="${ctx}/images/buttom_bgs.gif" width="17" height="17" /></td>
			<td background="${ctx}/images/mail_rightbg.gif"><img
				src="${ctx}/images/buttom_right2.gif" width="16" height="17" /></td>
		</tr>
	</table>
	<div id="queryDiv" style="background-color: #E1E5EE;width: 293px;height: 135px;position: absolute;top: 121px;right: 27px;display: none;">
		<form>
		<table cellpadding="0" cellspacing="0" style="font-size: 13px;">
			<tr>
				<td height="90" width="35%" align="right" valign="middle"><label>申请人名称：</label></td>
				<td>
					<input type="text" id="userName"/>
				</td>
			</tr>
			<tr>
				<td valign="top" align="center" colspan="2" height="35">
					<input type="button" value="确定" onclick="search()"/>　　　
					<input type="reset" value="重置"/>
				</td>
			</tr>
		</table>
		</form>
	</div>
</body>
</html>